Median of two sorted arrays of same size
There are 2 sorted arrays A and B of size n each. Write an algorithm to find the median of the array obtained after merging the above 2 arrays(i.e. array of length 2n). The complexity should be O(log(n))...
read more
K-th Element of Two Sorted Arrays
Given two sorted arrays of size m and n respectively, you are tasked with finding the element that would be at the k’th position of the final sorted array....
read more
Find the maximum element in an array which is first increasing and then decreasing
Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array. Examples :...
read more
Find Second largest element in an array | Set 2
Given an array arr[] consisting of N integers, the task is to find the second largest element in the given array using N+log2(N) – 2 comparisons....
read more
Maximize groups to be formed such that product of size of group with its minimum element is at least K
Given an array, arr[] of length N, and an integer K. The value of the i-th element is arr[i]. The task is to find the maximum number of groups such that for each group the product of the number of elements in that group and the minimum element is at least K....
read more
Number of ways to divide a given number as a set of integers in decreasing order
Given two numbers and . The task is to find the number of ways in which a can be represented by a set such that and the summation of these numbers is equal to a. Also (maximum size of the set cannot exceed m)....
read more
Find the missing number in Arithmetic Progression
Given an array that represents elements of arithmetic progression in order. One element is missing in the progression, find the missing number....
read more
Cisco Interview Experience (On-Campus)
Cisco recently visited my campus for 3 roles -:...
read more
Maximum Sum SubArray using Divide and Conquer | Set 2
Given an array arr[] of integers, the task is to find the maximum sum sub-array among all the possible sub-arrays.Examples:...
read more
Queries to check if any non-repeating element exists within range [L, R] of an Array
Given an array arr[] consisting of integers and queries Q of the form (L, R), the task is to check whether any non-repeating element is present within indices [L, R](1 based indexing) or not. If there is at least one non-repeating element, then print “Yes”. Otherwise, print “No”. Examples:...
read more
Cost Based Tower of Hanoi
The standard Tower of Hanoi problem is explained here . In the standard problem, all the disc transactions are considered identical. Given a 3×3 matrix costs[][] containing the costs of transfer of disc between the rods where costs[i][j] stores the cost of transferring a disc from rod i to rod j. Cost of transfer between the same rod is 0. Hence the diagonal elements of the cost matrix are all 0s. The task is to print the minimum cost in which all the N discs are transferred from rod 1 to rod 3.Examples:...
read more
Find closest number in Sorted array
Given an array of sorted integers. We need to find the closest value to the given number. Array may contain duplicate values and negative numbers....
read more